﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using Volo.Abp.Domain.Entities;
using Volo.Abp.MultiTenancy;

namespace Himp.Outpatient.OtpRgsts
{
    /// <summary>
    /// 门诊挂号记录
    /// id=就医流水号
    /// </summary>
    public class OtpRgstRecView : AggregateRoot<string>, IMultiTenant
    {
        #region 属性

        /// <summary>
        /// 门诊挂号记录Id
        /// </summary>
        [Column("OTP_RGST_REC_ID")]
        public Guid OtpRgstRecId { get; set; }

        /// <summary>
        /// 就诊流水号
        /// </summary>
        [Column("MDTRT_SN")]
        public string MdtrtSn { get; set; }

        ///// <summary>
        ///// 挂号方式
        ///// 现金 = 1,
        ///// 医保 = 2
        ///// </summary>
        //[Column("RGST_WAY")]
        //public EnumRgstWay RgstWay { get; private set; }

        /// <summary>
        /// 结算类别Id
        /// </summary>
        [Column("SETL_TYPE_ID")]
        public Guid SetlTypeId { get; set; }

        /// <summary>
        /// 患者Id
        /// </summary>
        [Column("PATN_ID")]
        public Guid? PatnId { get; set; }

        /// <summary>
        /// 门诊号
        /// </summary>
        [Column("OTP_NO")]
        public string? OtpNo { get; set; }

        /// <summary>
        /// 门诊排班记录id
        /// </summary>
        [Column("OTP_SCHD_REC_ID")]
        public Guid OtpSchdRecId { get; set; }

        /// <summary>
        /// 门诊排班记录明细id
        /// </summary>
        [Column("OTP_SCHD_REC_DETL_ID")]
        public Guid? OtpSchdRecDetlId { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        [Column("ORDER_ID")]
        public Guid? OrderId { get; set; }

        // <summary>
        /// 退款单ID
        /// </summary>
        [Column("REFUND_ID")]
        public Guid? RefundId { get; set; }

        ///// <summary>
        ///// 挂号状态
        ///// </summary>
        //[Column("RGST_STAS")]
        //public EnumRgstStatus RgstStas { get; set; }

        /// <summary>
        /// 结算类别编码
        /// </summary>
        [Column("SETL_TYPE_CODG")]
        public string SetlTypeCodg { get; private set; }

        /// <summary>
        /// 结算类别名称
        /// </summary>
        [Column("SETL_TYPE_NAME")]
        public string SetlTypeName { get; private set; }

        #region 门诊患者信息

        /// <summary>
        /// 人员姓名
        /// </summary>
        [Column("PSN_NAME")]
        public string PsnName { get; set; }

        ///// <summary>
        ///// 性别
        ///// </summary>
        //[Column("GEND")]
        //public EnumGender? Gend { get; set; }

        /// <summary>
        /// 出生日期
        /// </summary>
        [Column("BRDY")]
        public DateTime? Brdy { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        [Column("AGE")]
        public int? Age { get; set; }

        /// <summary>
        /// 就诊凭证类型
        /// 01 医保电子凭证
        /// 02 居民身份证
        /// 03 社会保障卡
        /// </summary>
        [Column("MDTRT_CERT_TYPE_CODE")]
        public string MdtrtCertTypeCode { get; set; }

        /// <summary>
        /// 就诊凭证类型
        /// 01 医保电子凭证
        /// 02 居民身份证
        /// 03 社会保障卡
        /// </summary>
        [Column("MDTRT_CERT_TYPE_NAME")]
        public string MdtrtCertTypeName { get; set; }

        /// <summary>
        /// 就诊凭证编号
        /// </summary>
        [Column("MDTRT_CERT_NO")]
        public string MdtrtCertNo { get; private set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        [Column("IDCARD")]
        public string? Idcard { get; set; }

        /// <summary>
        /// 现住址
        /// </summary>
        [Column("CURR_ADDR")]
        public string? CurrAddr { get; set; }

        /// <summary>
        /// 个人联系电话
        /// </summary>
        [Column("PSN_TEL")]
        public string? PsnTel { get; set; }

        #endregion

        #region 号源信息

        /// <summary>
        /// 挂号时间
        /// yyyy-MM-dd HH:mm:ss
        /// </summary>
        [Column("RGST_TIME")]
        public DateTime RgstTime { get; set; }

        /// <summary>
        /// 挂号类别代码
        /// 6.93挂号类别代码(rgst_type_code)
        /// </summary>
        [Column("REG_TYPE_CODE")]
        public string RegTypeCode { get; set; }

        /// <summary>
        /// 挂号类别名称
        /// </summary>
        [Column("REG_TYPE_NAME")]
        public string RegTypeName { get; set; }

        /// <summary>
        /// 科室编码
        /// </summary>
        [Column("DEPT_CODG")]
        public string DeptCodg { get; set; }

        /// <summary>
        /// 科室名称
        /// </summary>
        [Column("DEPT_NAME")]
        public string DeptName { get; set; }

        /// <summary>
        /// 医师编码
        /// </summary>
        [Column("DR_CODG")]
        public string? DrCodg { get; set; }

        /// <summary>
        /// 医师姓名
        /// </summary>
        [Column("DR_NAME")]
        public string? DrName { get; set; }

        /// <summary>
        /// 诊室代码
        /// </summary>
        [Column("CONS_RM_CODE")]
        public string? ConsRmCode { get; set; }

        /// <summary>
        /// 诊室名称
        /// </summary>
        [Column("CONS_RM_NAME")]
        public string? ConsRmName { get; set; }

        /// <summary>
        /// 复诊标记
        /// </summary>
        [Column("RNT_MDTRT_FLAG")]
        public bool RntMdtrtFlag { get; set; }

        /// <summary>
        /// 队列号
        /// </summary>
        [Column("QNO")]
        public string? Qno { get; set; }

        /// <summary>
        /// 分诊时间
        /// </summary>
        [Column("TRG_TIME")]
        public DateTime? TrgTime { get; set; }

        /// <summary>
        /// 签到时间
        /// </summary>
        [Column("SIGN_TIME")]
        public DateTime? SignTime { get; set; }

        #endregion

        #region 医保信息

        /// <summary>
        /// 就诊ID
        /// </summary>
        [Column("MDTRT_ID")]
        public string? MdtrtId { get; private set; }

        /// <summary>
        /// 人员编号
        /// </summary>
        [Column("PSN_NO")]
        public string? PsnNo { get; set; }

        /// <summary>
        /// 险种类型
        /// </summary>
        [Column("INSUTYPE")]
        public string? Insutype { get; set; }

        #endregion

        #region 订单信息

        /// <summary>
        /// 总金额
        /// </summary>
        [Column("AMT")]
        public decimal? Amt { get; set; }

        #endregion

        /// <summary>
        /// 
        /// </summary>
        public Guid? TenantId { get; set; }

        #endregion

        #region 方法

        public OtpRgstRecView()
        {

        }

        ///// <summary>
        ///// 
        ///// </summary>
        ///// <param name="otpRgstRecId"></param>
        ///// <param name="mdtrtSn"></param>
        ///// <param name="rgstWay"></param>
        ///// <param name="setlTypeId"></param>
        ///// <param name="patnId"></param>
        ///// <param name="otpNo"></param>
        ///// <param name="otpSchdRecId"></param>
        ///// <param name="otpSchdRecDetlId"></param>
        //public OtpRgstRecView(Guid otpRgstRecId, string mdtrtSn, EnumRgstWay rgstWay
        //    , Guid setlTypeId, Guid patnId, string otpNo, Guid otpSchdRecId
        //    , Guid? otpSchdRecDetlId)
        //{
        //    Id = mdtrtSn;
        //    OtpRgstRecId = otpRgstRecId;
        //    MdtrtSn = mdtrtSn;
        //    RgstWay = rgstWay;
        //    SetlTypeId = setlTypeId;
        //    PatnId = patnId;
        //    OtpNo = otpNo;
        //    OtpSchdRecId = otpSchdRecId;
        //    OtpSchdRecDetlId = otpSchdRecDetlId;
        //    RgstStas = EnumRgstStatus.创建中;
        //}

        ///// <summary>
        ///// 更新门诊患者信息
        ///// </summary>
        ///// <param name="psnName"></param>
        ///// <param name="Gend"></param>
        ///// <param name="Brdy"></param>
        ///// <param name="Age"></param>
        ///// <param name="MdtrtCertTypeCode"></param>
        ///// <param name="MdtrtCertTypeName"></param>
        ///// <param name="MdtrtCertNo"></param>
        ///// <param name="Idcard"></param>
        ///// <param name="CurrAddr"></param>
        ///// <param name="PsnTel"></param>
        //public void SetOtpPatnInfo(string psnName, EnumGender? gend, DateTime? brdy
        //    , string? idcard, string? currAddr, string? psnTel)
        //{
        //    PsnName = psnName;
        //    Gend = gend;
        //    Brdy = brdy;
        //    Age = 0;
        //    Idcard = idcard;
        //    CurrAddr = currAddr;
        //    PsnTel = psnTel;
        //}

        /// <summary>
        /// 更新挂号源信息
        /// </summary>
        /// <param name="rgstTime"></param>
        /// <param name="regTypeCode"></param>
        /// <param name="regTypeName"></param>
        /// <param name="deptCodg"></param>
        /// <param name="deptName"></param>
        /// <param name="drCodg"></param>
        /// <param name="drName"></param>
        /// <param name="consRmCode"></param>
        /// <param name="consRmName"></param>
        /// <param name="rntMdtrtFlag"></param>
        /// <param name="qno"></param>
        /// <param name="trgTime"></param>
        /// <param name="signTime"></param>
        public void SetRgstSrcInfo(DateTime rgstTime, string regTypeCode
            , string regTypeName, string deptCodg, string deptName, string? drCodg
            , string? drName, string? consRmCode, string? consRmName, bool rntMdtrtFlag
            , string? qno, DateTime? trgTime, DateTime? signTime)
        {
            RgstTime = rgstTime;
            RegTypeCode = regTypeCode;
            RegTypeName = regTypeName;
            DeptCodg = deptCodg;
            DeptName = deptName;
            DrCodg = drCodg;
            DrName = drName;
            ConsRmCode = consRmCode;
            ConsRmName = consRmName;
            RntMdtrtFlag = rntMdtrtFlag;
            Qno = qno;
            TrgTime = trgTime;
            SignTime = signTime;
        }

        #endregion
    }
}
